home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 66
/
Vol 66.iso
/
games
/
angel_fr.swf
/
scripts
/
frame_4
/
DoAction_7.as
< prev
next >
Wrap
Text File
|
2013-04-24
|
17KB
|
704 lines
stop();
var block_size = 20;
var block_space = 3;
var start_x = 159;
var start_y = 59;
var level_num = 1;
var a_cookie_0 = new Array(0,0);
var a_cookie_1 = new Array(0,0);
var n_cookie_0 = "";
var n_cookie_1 = "";
var cookie_click_num = 0;
var click_ok_flag = true;
var level_mission = 15;
var timer_ox = timer_m.timer_mask._x;
var hurry_up_make_flag = false;
level_txt = level_num;
mission_txt = level_mission;
score_board.score_txt = 0;
default_block_set = function()
{
var cookie_count = 0;
var i = 0;
while(i < 10)
{
var k = 0;
while(k < 10)
{
attachMovie("cookie_m","cookie_" + i + "_" + k,100 + cookie_count);
eval("cookie_" + i + "_" + k)._visible = false;
eval("cookie_" + i + "_" + k).selected_m._visible = false;
eval("cookie_" + i + "_" + k)._x = start_x + k * (block_size + block_space);
eval("cookie_" + i + "_" + k)._y = start_y + i * (block_size + block_space);
eval("cookie_" + i + "_" + k).gotoAndStop(a_chip[i][k]);
eval("cookie_" + i + "_" + k).onPress = function()
{
if(click_ok_flag && on_game_flag && !pause_flag)
{
sound_play(4,1);
var temp_a = this._name.split("_");
eval("a_cookie_" + cookie_click_num)[0] = temp_a[1];
eval("a_cookie_" + cookie_click_num)[1] = temp_a[2];
cookie_click_num++;
if(cookie_click_num == 1)
{
n_cookie_0 = this._name;
this.selected_m._visible = true;
}
if(cookie_click_num == 2)
{
if(a_cookie_0[0] != a_cookie_1[0] || a_cookie_0[1] != a_cookie_1[1])
{
n_cookie_1 = this._name;
click_ok_flag = false;
cookie_click_num = 0;
check_cookie_change();
}
else
{
cookie_click_num--;
}
}
}
};
cookie_count++;
k++;
}
i++;
}
};
check_cookie_change = function()
{
trace("----check_cookie_change----");
trace(a_cookie_0);
trace(a_cookie_1);
eval(n_cookie_0).selected_m._visible = false;
var temp_x = a_cookie_0[0] - a_cookie_1[0];
var temp_y = a_cookie_0[1] - a_cookie_1[1];
var temp_a = Math.abs(temp_x);
var temp_b = Math.abs(temp_y);
if(temp_a + temp_b == 1)
{
cookie_change();
}
else
{
trace("no_cookie_change!!!");
click_ok_flag = true;
}
};
cookie_change = function()
{
sound_play(5,1);
eval(n_cookie_0)._visible = false;
eval(n_cookie_1)._visible = false;
var temp_x = a_cookie_0[1] - a_cookie_1[1];
var temp_y = a_cookie_0[0] - a_cookie_1[0];
attachMovie("change_m","change_m",1000);
if(temp_x > 0)
{
change_m.gotoAndStop(1);
change_m._x = eval(n_cookie_1)._x;
change_m._y = eval(n_cookie_1)._y;
change_m.cookie.a.gotoAndStop(eval(n_cookie_1)._currentframe);
change_m.cookie.b.gotoAndStop(eval(n_cookie_0)._currentframe);
}
else if(temp_x < 0)
{
change_m.gotoAndStop(1);
change_m._x = eval(n_cookie_0)._x;
change_m._y = eval(n_cookie_0)._y;
change_m.cookie.a.gotoAndStop(eval(n_cookie_0)._currentframe);
change_m.cookie.b.gotoAndStop(eval(n_cookie_1)._currentframe);
}
else if(temp_y > 0)
{
change_m.gotoAndStop(2);
change_m._x = eval(n_cookie_1)._x;
change_m._y = eval(n_cookie_1)._y;
change_m.cookie.a.gotoAndStop(eval(n_cookie_1)._currentframe);
change_m.cookie.b.gotoAndStop(eval(n_cookie_0)._currentframe);
}
else if(temp_y < 0)
{
change_m.gotoAndStop(2);
change_m._x = eval(n_cookie_0)._x;
change_m._y = eval(n_cookie_0)._y;
change_m.cookie.a.gotoAndStop(eval(n_cookie_0)._currentframe);
change_m.cookie.b.gotoAndStop(eval(n_cookie_1)._currentframe);
}
};
cookie_change_end = function()
{
trace("cookie_change_end");
change_m.removeMovieClip();
var n_cookie_0_temp = eval(n_cookie_0)._currentframe;
eval(n_cookie_0).gotoAndStop(eval(n_cookie_1)._currentframe);
eval(n_cookie_1).gotoAndStop(n_cookie_0_temp);
var temp_0 = n_cookie_0.split("_");
var temp_1 = n_cookie_1.split("_");
a_chip[temp_0[1]][temp_0[2]] = eval(n_cookie_0)._currentframe;
a_chip[temp_1[1]][temp_1[2]] = eval(n_cookie_1)._currentframe;
eval(n_cookie_0)._visible = true;
eval(n_cookie_1)._visible = true;
same_block_check();
};
same_block_check = function()
{
var _loc2_ = 0;
while(_loc2_ < 10)
{
var _loc1_ = 0;
while(_loc1_ < 10)
{
a_temp[_loc2_][_loc1_] = 0;
_loc1_ = _loc1_ + 1;
}
_loc2_ = _loc2_ + 1;
}
var _loc12_ = false;
_loc2_ = 0;
while(_loc2_ < 9)
{
_loc1_ = 0;
while(_loc1_ < 9)
{
var _loc8_ = a_chip[_loc2_][_loc1_];
var _loc11_ = a_chip[_loc2_][_loc1_ + 1];
var _loc10_ = a_chip[_loc2_ + 1][_loc1_];
var _loc9_ = a_chip[_loc2_ + 1][_loc1_ + 1];
var _loc6_ = [];
var _loc3_ = [];
_loc6_.push(_loc8_,_loc11_,_loc10_,_loc9_);
if(_loc8_ != 0)
{
var _loc7_ = 0;
var _loc5_ = 0;
while(_loc5_ < 4)
{
if(_loc6_[_loc5_] != 13)
{
_loc3_.push(_loc6_[_loc5_]);
}
_loc5_ = _loc5_ + 1;
}
var _loc4_ = 0;
while(_loc4_ < _loc3_.length + 1)
{
if(_loc3_[_loc4_] == _loc3_[_loc4_ + 1])
{
_loc7_ = _loc7_ + 1;
}
_loc4_ = _loc4_ + 1;
}
if(_loc3_.length == _loc7_ || _loc3_.length == 0)
{
a_temp[_loc2_][_loc1_] = 1;
a_temp[_loc2_][_loc1_ + 1] = 1;
a_temp[_loc2_ + 1][_loc1_] = 1;
a_temp[_loc2_ + 1][_loc1_ + 1] = 1;
a_check[_loc2_][_loc1_] = 1;
_loc12_ = true;
danchoo_smile_m.gotoAndPlay(2);
del_same_cookie();
}
}
_loc1_ = _loc1_ + 1;
}
_loc2_ = _loc2_ + 1;
}
if(!_loc12_)
{
click_ok_flag = true;
}
};
del_same_cookie = function()
{
var i = 0;
while(i < 10)
{
var k = 0;
while(k < 10)
{
if(a_temp[i][k] == 1)
{
trace("AA");
eval("cookie_" + i + "_" + k)._visible = false;
a_chip[i][k] = 0;
}
k++;
}
i++;
}
trace("del_same_cookie====");
make_box();
};
var box_count = 0;
var ok_box_count = 0;
make_box = function()
{
var i = 0;
while(i < 10)
{
var k = 0;
while(k < 10)
{
if(a_check[i][k] == 1)
{
mission_txt--;
timer_m.timer_mask._x += 5;
if(timer_m.timer_mask._x >= timer_ox)
{
timer_m.timer_mask._x = timer_ox;
}
ok_box_count++;
trace("ok_box_count=" + ok_box_count);
attachMovie("box_m","box_m" + box_count,2000 + box_count);
var xx = start_x + k * (block_size + block_space) - 11;
var yy = start_y + i * (block_size + block_space) - 11;
eval("box_m" + box_count)._x = xx;
eval("box_m" + box_count)._y = yy;
box_count++;
if(!auto_same_flag)
{
if(box_count == 2)
{
make_score(xx,yy,3);
plus_score(150);
}
else
{
make_score(xx,yy,2);
plus_score(120);
}
}
else
{
make_score(xx,yy,1);
plus_score(80);
}
if(box_count == 5)
{
box_count = 0;
}
}
k++;
}
i++;
}
var i = 0;
while(i < 10)
{
var k = 0;
while(k < 10)
{
a_check[i][k] = 0;
k++;
}
i++;
}
};
var score_m_count = 0;
make_score = function(xx, yy, num)
{
trace("make_score");
score_m_count++;
attachMovie("score_num","score_num" + score_m_count,13000 + score_m_count);
eval("score_num" + score_m_count)._x = xx + 17;
eval("score_num" + score_m_count)._y = yy + 25;
trace(eval("score_num" + score_m_count)._y);
eval("score_num" + score_m_count).score.gotoAndStop(num);
sound_play(6,1);
};
del_box = function()
{
var i = 0;
while(i < 5)
{
eval("box_m" + i).removeMovieClip();
i++;
}
make_new_cookie();
if(ok_box_count >= level_mission)
{
make_level_clear();
}
};
make_level_clear = function()
{
if(on_game_flag)
{
click_ok_flag = false;
on_game_flag = false;
trace("level up!!!!!!!!!!!!!!!!!!!");
stopAllSounds();
clear_m.gotoAndPlay(2);
}
};
var interval_new_cookie_del_time = 0;
var auto_same_flag = false;
make_new_cookie = function()
{
auto_same_flag = false;
trace("make_new_cookie ");
var i = 0;
while(i < 10)
{
var k = 0;
while(k < 10)
{
if(a_temp[i][k] == 1)
{
a_chip[i][k] = get_cookie_num();
eval("cookie_" + i + "_" + k)._visible = true;
eval("cookie_" + i + "_" + k).gotoAndStop(a_chip[i][k]);
}
k++;
}
i++;
}
if(only_same_block_check())
{
if(on_game_flag)
{
auto_same_flag = true;
interval_new_cookie_del_time = 0;
this.onEnterFrame = function()
{
interval_new_cookie_del_time++;
if(interval_new_cookie_del_time == 20)
{
same_block_check();
delete this.onEnterFrame;
}
};
}
}
else
{
var i = 0;
while(i < 10)
{
var k = 0;
while(k < 10)
{
eval("cookie_" + i + "_" + k)._visible = true;
eval("cookie_" + i + "_" + k).gotoAndStop(a_chip[i][k]);
a_temp[i][k] = 0;
k++;
}
i++;
}
click_ok_flag = true;
}
};
only_same_block_check = function()
{
var _loc12_ = false;
var _loc6_ = 0;
while(_loc6_ < 9)
{
var _loc4_ = 0;
while(_loc4_ < 9)
{
var _loc8_ = a_chip[_loc6_][_loc4_];
var _loc11_ = a_chip[_loc6_][_loc4_ + 1];
var _loc10_ = a_chip[_loc6_ + 1][_loc4_];
var _loc9_ = a_chip[_loc6_ + 1][_loc4_ + 1];
var _loc5_ = [];
var _loc1_ = [];
_loc5_.push(_loc8_,_loc11_,_loc10_,_loc9_);
var _loc7_ = 0;
if(_loc8_ != 0)
{
var _loc3_ = 0;
while(_loc3_ < 4)
{
if(_loc5_[_loc3_] != 13)
{
_loc1_.push(_loc5_[_loc3_]);
}
_loc3_ = _loc3_ + 1;
}
var _loc2_ = 0;
while(_loc2_ < _loc1_.length + 1)
{
if(_loc1_[_loc2_] == _loc1_[_loc2_ + 1])
{
_loc7_ = _loc7_ + 1;
}
_loc2_ = _loc2_ + 1;
}
if(_loc1_.length == _loc7_ || _loc1_.length == 0)
{
_loc12_ = true;
}
}
_loc4_ = _loc4_ + 1;
}
_loc6_ = _loc6_ + 1;
}
return _loc12_;
};
get_cookie_num = function()
{
if(level_num < 3)
{
if(random(30) == 0)
{
return 13;
}
return random(3) + 1;
}
if(level_num < 5)
{
if(random(25) == 0)
{
return 13;
}
return random(4) + 1;
}
if(level_num < 7)
{
if(random(25) == 0)
{
return 13;
}
return random(5) + 1;
}
if(level_num < 9)
{
if(random(25) == 0)
{
return 13;
}
return random(6) + 1;
}
if(level_num < 12)
{
if(random(20) == 0)
{
return 13;
}
return random(7) + 1;
}
if(level_num < 15)
{
if(random(20) == 0)
{
return 13;
}
return random(8) + 1;
}
if(level_num < 19)
{
if(random(15) == 0)
{
return 13;
}
return random(9) + 1;
}
if(level_num < 23)
{
if(random(15) == 0)
{
return 13;
}
return random(10) + 1;
}
if(level_num < 27)
{
if(random(15) == 0)
{
return 13;
}
return random(11) + 1;
}
if(random(15) == 0)
{
return 13;
}
return random(12) + 1;
};
get_mission_num = function()
{
if(level_num < 4)
{
level_mission += 2;
}
else if(level_num < 7)
{
level_mission += 2;
}
else if(level_num < 14)
{
level_mission += 3;
}
else if(level_num < 16)
{
level_mission += 3;
}
else if(level_num < 21)
{
level_mission += 4;
}
else if(level_num < 26)
{
level_mission += 4;
}
else if(level_num < 31)
{
level_mission += 5;
}
else
{
level_mission += 6;
}
mission_txt = level_mission;
return level_mission;
};
get_not_same_cookie_array = function()
{
var _loc2_ = 0;
while(_loc2_ < 10)
{
var _loc1_ = 0;
while(_loc1_ < 10)
{
a_chip[_loc2_][_loc1_] = get_cookie_num();
_loc1_ = _loc1_ + 1;
}
_loc2_ = _loc2_ + 1;
}
if(only_same_block_check())
{
get_not_same_cookie_array();
}
else
{
default_block_set();
}
};
show_a_temp = function()
{
trace("------- a_temp ------------");
var _loc1_ = 0;
while(_loc1_ < 10)
{
trace(a_temp[_loc1_]);
_loc1_ = _loc1_ + 1;
}
};
show_a_chip = function()
{
trace("------- a_chip ------------");
var _loc1_ = 0;
while(_loc1_ < 10)
{
trace(a_chip[_loc1_]);
_loc1_ = _loc1_ + 1;
}
};
start_game = function()
{
hurry_up_make_flag = false;
on_game_flag = true;
click_ok_flag = true;
make_timer();
sound_play(0,99999,1);
};
make_timer = function()
{
timer_m.onEnterFrame = function()
{
if(on_game_flag && !pause_flag)
{
this.timer_mask._x -= 0.1;
if(this.timer_mask._x < -225)
{
delete this.onEnterFrame;
make_game_over();
}
else if(this.timer_mask._x < -150 && !hurry_up_make_flag)
{
sound_play(7,1);
hurry_up_make_flag = true;
hurry_up_m.gotoAndPlay(2);
}
}
};
};
make_game_over = function()
{
eval(n_cookie_0).selected_m._visible = false;
stopAllSounds();
on_game_flag = false;
game_over_m.gotoAndPlay(2);
};
var show_count = 0;
var v_i = 0;
var v_k = 0;
show_cookie = function()
{
v_k = 0;
v_i = 0;
show_count = 0;
this.onEnterFrame = function()
{
eval("cookie_" + v_i + "_" + v_k)._visible = true;
eval("cookie_" + v_i + "_" + (v_k + 1))._visible = true;
v_k += 2;
if(v_k % 10 == 0)
{
v_k = 0;
v_i++;
if(v_i == 10)
{
delete this.onEnterFrame;
ready_m.gotoAndPlay(31);
}
}
};
};
plus_clear_score = function()
{
sound_play(3,10,1);
timer_m.onEnterFrame = function()
{
plus_score(11);
this.timer_mask._x -= 4;
if(this.timer_mask._x < -225)
{
stopAllSounds();
clear_m.gotoAndPlay(17);
delete this.onEnterFrame;
}
};
};
make_next_stage = function()
{
level_num++;
level_txt = level_num;
var i = 0;
while(i < 10)
{
var k = 0;
while(k < 10)
{
eval("cookie_" + i + "_" + k)._visible = false;
a_chip[i][k] = 0;
a_temp[i][k] = 0;
a_check[i][k] = 0;
k++;
}
i++;
}
ok_box_count = 0;
get_mission_num();
timer_m.timer_mask._x = timer_ox;
get_not_same_cookie_array();
ready_m.gotoAndPlay(2);
};
get_not_same_cookie_array();
ready_m.gotoAndPlay(2);